import '../../presentation/controllers/MapDataController.dart';

class DownloadData {
  DownloadData({
    required this.layers,
    required this.params,
    this.status = MapTaskStatus.INIT,
    this.x = 0,
    this.y = 0,
    this.z = 0,
    this.total = 0,
    this.downSuc = 0,
    this.downFailt = 0,
  });

  final List<LayerBean> layers;
  final MapDownloadParams params;
  int z, x, y;
  MapTaskStatus status;
  int total = 0, downSuc = 0, downFailt = 0;
  int startTime = 0, endTime = 0;
  LayerBean? curLayerBean = null;

  String toView() {
    return "${getStatus()} 总计：$total cur: z:$z x:$x y:$y 成功：$downSuc 失败：$downFailt";
  }

  String getStatus() {
    String str = "";
    switch (status) {
      case MapTaskStatus.INIT:
        str = "初始化";
      case MapTaskStatus.START:
        str = "开始下载";
      case MapTaskStatus.DOWNING:
        str = "下载中";
      case MapTaskStatus.PAUSE:
        str = "下载暂停";
      case MapTaskStatus.STOP:
        str = "下载停止";
      case MapTaskStatus.SUCCESS:
        str = "下载完成";
      case MapTaskStatus.FAIL:
        str = "下载失败";
    }
    return str;
  }
}

enum MapTaskStatus {
  INIT,
  START,
  DOWNING,
  PAUSE,
  STOP,
  SUCCESS,
  FAIL,
}
